|
|
|
Creating Your Own Plugins |
|
Do you have one or more favorite websites you would like to search using DEVONagent Pro? While the potential to create a bespoke plugin depends on the specific site, DEVONagent Pro has a built-in tool to aid in creating a site-specific plugin. This chapter guides you in using its integrated plugin assistant to create an XML plugin, walking you through a real-world, practical example.
Now let's create a simple functional plugin from scratch! Step 1 Open a browser window for search.acs.org in DEVONagent Pro or any other web browser. Search for "mercury".
At the bottom of the results, Control-click the Next link and copy the link. Leave this window open while developing the plugin. Step 2 Choose
File > New Plugin. This will open the
Plugins & Scanners window. In the URL field, paste the copied link, and replace
Step 3 Let's test the plugin. Press the Test button at the top of the Plugins & Scanners window. The results show the created plugin is functioning but is causing unnecessary traffic and returning many unnecessary results. Select any unwanted links in the Log, e.g., Twitter, Facebook, mailto, etc. Control-click one, and choose Exclude Domain.
Also, select one of the links with
Step 4 Now choose
File > New Search. Select our new plugin from the options under the magnifying glass. Run a test search using the search term When we examine the URL of the results in the browser window, we can see they are from
<key>LinksMatching</key> Also make sure the Running a new search, we get some results. We're not quite there but we are targeting the correct domain! Now let's use another powerful set of keys:
If you have enabled Developer Extras in Preferences > Web, you can Control- or right-click parts of the rendered page, e.g., the title of the article, and choose Inspect Element. Also, select items in the markup in the developer tools and the item on the rendered page will be highlighted. Otherwise, you can select Web > Source to show the HTML source and search for items in the content of the page. Inspect or find the title of the article. In this case, notice it's an
<key>TextStart</key> Now let's give this another try. We rerun the
Further Finetuning We now have a working plugin for the acs.org site. You can check both the results and digest panes in the Search window to further fine tune your plugin. Below are some useful keys used to more accurately target elements or properties, e.g., the date, from the resulting pages.
As mentioned above, you can examine the HTML source code of results and try to find strings that can be used for these keys. When looking at the topics in the digest pane after you've done your searches, you can set the
<key>NoTopics</key> In other cases, you might also want to look at the source of the plugin and validate the values for In addition, DEVONagent Pro may not always be able to insert the Finally, uncheck any operators the search engine doesn't support. Congratulations With the steps described in this tutorial, you should be able to go through the steps of writing a plugin yourself. With a bit of practice, it is possible to write an optimized plugin that will deliver good results for DEVONagent Pro to work with. It might help to look at the additional plugins that already come with DEVONagent Pro before designing your own plugin. For the built-in plugins, Control- or right-click and duplicate a plugin. You can then open and inspect its internal code. And remember: If you think your plugin is great for others, please share it with us! |